package day3zy;

import java.util.Collections;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Mapcs {
        public static void main(String[] args) {
            System.out.println("请输入一个字符串：");
            Scanner in = new Scanner(System.in);
            String str = in.next();
            java.util.Map<Character, Integer> map = new TreeMap<>(Collections.reverseOrder());
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                map.put(ch, map.getOrDefault(ch, 0) + 1);
            }
            for (Map.Entry<Character, Integer> entry : map.entrySet()) {
                System.out.println(entry.getKey() + ": " + entry.getValue());
            }
        }
    }


